home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PAS_0793 / ROLLBITS.PAS < prev    next >
Pascal/Delphi Source File  |  1993-08-01  |  712b  |  17 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 347 of 454
  3. From : Leon Deboer                         3:690/101.0          08 Jul 93  01:51
  4. To   : Ferenc Molnar
  5. Subj : Shr, Bits and ???
  6. ────────────────────────────────────────────────────────────────────────────────
  7. Here is code to roll bits of a byte in Bp 7 assembler high bit first}
  8.  
  9. FUNCTION RollOfBits (Value, RollCount: Byte): Byte; ASSEMBLER;
  10. ASM
  11.    XOR AX, AX;
  12.    XOR CX, CX;                                 { Clear registers }
  13.    MOV AL, [Value];
  14.    MOV CL, [RollCount];                        { Load values }
  15.    SHR AX, CL;
  16.    XCHG AH, AL;                                { Flip registers }
  17. END;